package com.situ.day05;

import java.util.Scanner;

import org.junit.Test;

public class WeekendWork {
	
	@Test
	public void test1() {
		for(int i = 5;i >=1;i--){
			for(int j = 1;j < i;j++){
				System.out.print("*");
			}
			System.out.println();
		}
	}
	@Test
	public void test2() {
		Scanner scanner = new Scanner(System.in);
		String num1 = scanner.nextLine();//输入的数
		int num2 = scanner.nextInt();//有多少个数
		int sum = 0;//结果
		//相加多少次
		for (int i = 1; i <= num2; i++) {
			String num3 = "";
			for (int j = 1; j <= i; j++) {
				num3 = num3 + num1;//字符串相加
			}
			int num = Integer.valueOf(num3);//将第i个值转换为整型
			sum = sum + num;//每个值相加的和
		}
		System.out.println("结果为："+sum);
	}
	
	@Test
	public void test3() {
		int[] score={80,45,60,100,89,92,93,75,100,71};
		int count1 = 0;
		int count2 = 0;
		int count3 = 0;
		for (int i = 0; i < score.length; i++) {
			if (score[i] == 100) {
				count1++;
			}else if (score[i] >= 90&&score[i] < 100) {
				count2++;
			}else if (score[i] >= 80&&score[i] < 900) {
				count3++;
			}
		}
		System.out.println("100的个数\t"+count1+"\t90-100d的个数"
				+ ""+count2+"\t80-90的个数"+count3);

	}
	
	@Test
	public void test4() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入一串字符：");
		String str = scanner.next();
		char[] array = str.toCharArray();
		boolean isHuiWen = true;
		for (int i = 0; i < array.length/2; i++) {
			System.out.println(array[i]);
			if (array[i] != array[array.length - 1 -i]) {
				isHuiWen = false;
				break;
			}
		}
		if(isHuiWen == true) {
			System.out.println("是回文数");
		}else {
			System.out.println("不是回文数");
		}
	}
	
}
